/* 学习目标：掌握编程式导航的使用  */

import React from 'react';
// 1. 导入useNavigate
import { useNavigate } from 'react-router-dom';

export default function Friend() {
  const navigate = useNavigate();

  const handleClick = () => {
    // navigate('/home');  // 🔔类似router.push
    navigate(-1); // 🔔类似router.back
  };

  return (
    <div>
      朋友
      <button onClick={handleClick}>点我</button>
    </div>
  );
}
